package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorsMapper {

    /**
     * 遍历插入 对应的菜品口味
     * @param flavors
     */
    void insertFlavors(List<DishFlavor> flavors);

    /**
     * 遍历菜品口味内是否有该菜品  这是动态遍历多个id
     * @param ids
     */
    void deleteDish(List<Long> ids);

    /**
     *  删除菜品口味内该菜品 这是只有一个id
     */
    @Delete("delete from dish_flavor where dish_id=#{dishid}")
    void deleteDishFlavors(Long dishid);

    /**
     * 根据菜品id 查询口味中对应的菜品数据
     * @param dishid
     * @return
     */
    @Select("select * from dish_flavor where dish_id=#{dishid}")
    List<DishFlavor> getFlavors(Long dishid);



}
